package com.ruoyi.qiushi.service.user.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.qiushi.domain.user.MemberAddress;
import com.ruoyi.qiushi.mapper.user.MemberAddressMapper;
import com.ruoyi.qiushi.service.user.IMemberAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 收货地址管理Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-28
 */
@Service
public class MemberAddressServiceImpl implements IMemberAddressService {
    @Autowired
    private MemberAddressMapper memberAddressMapper;

    /**
     * 查询收货地址管理
     *
     * @param id 收货地址管理主键
     * @return 收货地址管理
     */
    @Override
    public MemberAddress selectMemberAddressById(Long id) {
        return memberAddressMapper.selectMemberAddressById(id);
    }

    /**
     * 查询收货地址管理列表
     *
     * @param memberAddress 收货地址管理
     * @return 收货地址管理
     */
    @Override
    public List<MemberAddress> selectMemberAddressList(MemberAddress memberAddress) {
        return memberAddressMapper.selectMemberAddressList(memberAddress);
    }

    /**
     * 新增收货地址管理
     *
     * @param memberAddress 收货地址管理
     * @return 结果
     */
    @Override
    public int insertMemberAddress(MemberAddress memberAddress) {
        memberAddress.setCreateTime(DateUtils.getNowDate());
        return memberAddressMapper.insertMemberAddress(memberAddress);
    }

    /**
     * 修改收货地址管理
     *
     * @param memberAddress 收货地址管理
     * @return 结果
     */
    @Override
    public int updateMemberAddress(MemberAddress memberAddress) {
        memberAddress.setUpdateTime(DateUtils.getNowDate());
        return memberAddressMapper.updateMemberAddress(memberAddress);
    }

    /**
     * 删除收货地址管理信息
     *
     * @param id 收货地址管理主键
     * @return 结果
     */
    @Override
    public int deleteMemberAddressById(Long id) {
        return memberAddressMapper.deleteMemberAddressById(id);
    }
}
